package com.javasm.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author：xls
 * @Version：1.0
 * @Date：2021/11/8-15:45
 * @Since:jdk1.8
 * @Description:
 */
@Controller
public class IndexController {

    @RequestMapping(value = "/say")
    public ModelAndView say() {
        ModelAndView mv = new ModelAndView();
        mv.addObject("message","Hello,SpringBoot");
        mv.setViewName("say");
        return mv;
    }

    @RequestMapping(value = "/index")
    public String index(Model model) {
        model.addAttribute("message","HelloWorld");
        return "say";
    }
}